package com.yc.damai.web;

import com.yc.damai.entity.DmProduct;
import com.yc.damai.web.feign.OtherAction;
import com.yc.damai.web.feign.OtherActionImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class IndexDo {

    @Resource
    OtherAction otherAction;

    @Resource
    OtherActionImpl otherActionImpl;

    @RequestMapping("queryNewAndHot")
    Object queryNewAndHot(){
        Map<String, List<DmProduct>> data = otherAction.queryNewAndHot();
        // 扩展: 每隔1小时, 更新一次缓存
        otherActionImpl.setCacheNewAndHot(data);
        return data;
    }

}
